/*
 * This file (ScriptDocument.java) is protected by the GNU GPL licence (v2). 
 * Please read the license.txt attached for further informations. 
 * 
 */
package org.algoristes.alkwarel.gui;

import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.DefaultStyledDocument;

import org.algoristes.alkwarel.utils.Constants;

/**
 * A styled document enabling syntax coloration
 * 
 * @author Xavier Gouchet
 * 
 */
public class ScriptDocument extends DefaultStyledDocument implements Constants,
		GUIConstants {

	private static final long serialVersionUID = V_SERIAL_UID;

	/**
	 * @see DefaultStyledDocument#insertString(int, String, AttributeSet)
	 */
	public void insertString(int offs, String str, AttributeSet a)
			throws BadLocationException {
		str = str.replaceAll("\t", "  ");
		super.insertString(offs, str, a);
	}
}
